complexorder is package {
  -- import actors;
  
  type EventItem is event{
    createdTimestamp has type long;
  };
  
--  AA is actor{
    LocalizedActualEventItems has type relation of {containerId has type string;
      event has type EventItem;
      locale has type string;
    };
    
    LocalizedActualEventItems is relation{
      { containerId = "first"; event=event{createdTimestamp=0L}; locale="somewhere"};
      { containerId = "second"; event=event{createdTimestamp=1L}; locale="nowhere"}
    };
--  };
    
  main() do {
    QQ is -- query AA's LocalizedActualEventItems with
      all x.event where x in LocalizedActualEventItems order by x.event.createdTimestamp;
      
    logMsg(info,"$QQ");
  }
}